﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommandLogic.Command;

namespace CommandLogic
{
    public enum QsmCommand
    {
        CreateBlock,
        DeleteBlock,
        ConnectBlocks,
        DisconnectBlocks,
        Start,
        Pause,
        Stop,
        UpdateStatistic,
        DeleteAllBlocks
    }

    public static class QsmCommandFactory
    {
        private static readonly Dictionary<QsmCommand, IQsmCommand> _commands;

        static QsmCommandFactory()
        {
            _commands = new Dictionary<QsmCommand, IQsmCommand>
                            {
                                {QsmCommand.CreateBlock, new CreateBlockCommand()},
                                {QsmCommand.ConnectBlocks, new ConnectBlocksCommand()},
                                {QsmCommand.DeleteBlock, new DeleteBlockCommand()},
                                {QsmCommand.DisconnectBlocks, new DisconnectBlocksCommand()},
                                {QsmCommand.Start, new StartCommand()},
                                {QsmCommand.Pause, new PauseCommand()},
                                {QsmCommand.Stop, new StopCommand()},
                                {QsmCommand.UpdateStatistic, new UpdateStatisticCommand()},
                                {QsmCommand.DeleteAllBlocks, new DeleteAllBlocksCommand()}
                            };
        }

        public static IQsmCommand GetCommand(QsmCommand command)
        {
            return _commands[command];
        }
    }
}
